package demo_0402;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Calendar_demo {
    public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE,10);  //首个参数是要加的，第二个参数为加的数
        System.out.println(calendar);
        Date date = calendar.getTime();
        System.out.println(date);
        System.out.println("-------------------");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        String str = sdf.format(date);
        System.out.println(str);
        System.out.println("-------------------");
        Calendar nationtime = Calendar.getInstance();
        nationtime.set(2025,9,1);
        Date date1 = nationtime.getTime();
        System.out.println(date1);
    }
}
